package annotationAop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

/**
 * Created by zwj on 15/9/29.
 */
@Aspect
public class UserInterceptor {

    @Before("execution(public void annotationAop.UserService.*(..)) ")
    public void beforeMethod(){
        System.out.println("method before");
    }

    @After("execution(public void UserService.*(..))")
    public void afterMethod(){
        System.out.println("method after");
    }

    @AfterReturning("execution(public * UserService.*(..))")
    public void afterReturning(){
        System.out.println("method after returning");
    }

    @AfterThrowing("execution(public * annotationAop.UserService.*(..))")
    public void afterThrowing(){
        System.out.println("method throws exception");
    }
    @Around("execution(public * annotationAop.UserService.*(..))")
    public void around(ProceedingJoinPoint pjp) throws Throwable{
        System.out.println("method around start");
        pjp.proceed();
        System.out.println("method around end");
    }
}
